

import fs from "fs"
function main () {
    const w = 2000
    const h = 2000
    const point = { x: 1000, y: 1000 }

    let map = new Map()

    for (let x = 0; x < w; x++) {
        for (let y = 0; y < h; y++) {

            let d = Math.sqrt((x - point.x) ** 2 + (y - point.y) ** 2)
            if (d == 0) continue
            if (!map.has(d)) {
                map.set(d, [{ x: x - point.x, y: y - point.y }])
                continue
            }
            map.get(d).push({ x: x - point.x, y: y - point.y })
        }
    }

    const list = Array.from(map.keys()).sort((a, b) => a - b).filter(d => d <= 50).map(d => {
        return {
            d,
            p: map.get(d)
        }
    })
    fs.writeFileSync("data.json", JSON.stringify(list))
}


main()